package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description 售后订单状态
 * @Author WJH
 * @Date 2021/03/25
 */
public enum RefundOrderStatus {
    UNREFUND(0, "待审核"),
    APPROVAL(1, "待复审"),
    REFUNDED(2, "理赔成功"),
    REFUSED(3, "拒绝理赔"),
    CANCELED(4, "已取消"),
    NO_PASSED(5, "不通过"),
    ;
    /**
     * 售后订单类型
     */
    public static final Integer orderType = 2;


    private int status;
    private String desc;

    RefundOrderStatus(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public int getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public static RefundOrderStatus resolve(int status) {
        return Arrays.stream(values()).filter(v -> v.status == status).findFirst().orElseThrow(() -> new RuntimeException("受理订单状态值[" + status + "]有误"));
    }


    @Override
    public String toString() {
        return String.format("[%s:%s]",status,desc);
    }
}
